package com.fhz.day002;

import android.os.Bundle;

import androidx.annotation.Nullable;
import androidx.databinding.DataBindingUtil;
import androidx.databinding.ViewDataBinding;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.fhz.day002.databinding.FengHongZhangImpl;
import com.fhz.fhzutil.LiveDataCallAdapterFactory;

import java.util.ArrayList;
import java.util.List;


public class BlankFragment extends Fragment {
   FengHongZhangImpl binding;
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
//        View inflate = inflater.inflate(R.layout.fragment_blank, container, false);
        binding = DataBindingUtil.inflate(inflater, R.layout.fragment_blank, container, false);

        LiveDataCallAdapterFactory liveDataCallAdapterFactory = new LiveDataCallAdapterFactory();
        return binding.getRoot();
    }

    @Override
    public void onActivityCreated(@Nullable Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);

        binding.fgText.setText("哈哈哈");

        binding.fgRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));

        List<Food> list = new ArrayList<>();
        list.add(new Food("xiaoming","http://www.qubaobei.com/ios/cf/uploadfile/132/9/8289.jpg"));
        list.add(new Food("daming","http://www.qubaobei.com/ios/cf/uploadfile/132/9/8289.jpg"));
        MyAdapter myAdapter = new MyAdapter(list);
        binding.fgRecyclerView.setAdapter(myAdapter);


    }
}